﻿@using DNA.Mvc.Community.Controllers;
·@using System.Web.UI.WebControls;
@model  IEnumerable<Thread>
@{       
    var forum = (ForumWrapper)ViewData["Forum"];
    var context = WebSiteContext.Current;
}
@{Html.RenderPartial("Detail", forum); }
<div style="margin-bottom: 5px; height: 30px; margin-left: 3px;">
    @Ajax.ForumMapPath(forum.ID)
</div>
@Ajax.Dna().WidgetZone(Html.Global("RES_TOPBANNER"), "zone1").GetHtml()
@if (context.IsAuthorized<PostController>("New"))
{
    if ((forum.IsModerator(Context)) || (!forum.IsLocked) || User.IsAdministrator())
    {
    @(Ajax.Dna().Button("NewThreadButton")
                .HtmlAttributes(new { style = "" })
                .ChangeType(ButtonTypes.LinkButton)
                .NavigateUrl(Url.Action("New", "Post", new { forumID = forum.ID.ToString() }))
                .Images(Url.Content("~/Content/Themes/" + context.Web.Theme + "/images/ui-forum-newthread.png"),
                    Url.Content("~/Content/Themes/" + context.Web.Theme + "/images/ui-forum-newthread-hover.png"))
                .GetHtml()
                )
    }
}
@{
    Ajax.Dna().Grid(Model)
    .Columns(cols =>
    {
        cols.Bound(m => m.ID).Title("").Width(40).Template(@<text>
    @Community.GetThreadIconHtml(item)
    </text>);
        cols.Bound(m => m.Title).Title(Html.Global("forums", "Thread")).Template(@<text>
    <h2 class="d-forums-thread-title">
        @Html.ActionLink(string.IsNullOrEmpty(item.Title) ? "[" + Html.Global("forums", "NewThread") + "]" : Html.Cut(item.Title, 50), "Index", "Thread", new { id = item.ID }, new { title = item.Title })
    </h2>
    <div style="display: inline-block; margin-left: 5px; color: #a8a8a8;">
        <span style="float: left;">@Html.Global("forums", "By") &nbsp;</span>
        @Html.UserLink(item.Author, new { style = "float:left;" })
        <span style="float: left; margin-left: 5px;">»&nbsp;@Html.Global(item.Posted)
        </span>
    </div>
    </text>);
        cols.Bound(m => m.TotalReads).Title(Html.Global("forums", "Views")).Template(@<text>
    <div class="d-forums-list-cell">@item.TotalReads</div>
    </text>).Width(100).TextAlign(HorizontalAlign.Right);
        cols.Bound(m => m.TotalPosts).Title(Html.Global("forums", "Replies")).Template(@<text>
    <div class="d-forums-list-cell">@item.TotalPosts</div>
    </text>).Width(100).TextAlign(HorizontalAlign.Right);
        cols.Bound(m => m.LastPostID).Title(Html.Global("forums", "LastPost")).Template(@<text>
    @if (item.LastPost == null)
    {
        <span>-</span>
    }
    else
    {
        Html.RenderPartial("LastPostCell", item.LastPost);
    }
    </text>);
    })
          .Sortable(cols =>
          {
              cols.Add(m => m.Title);
          })
          .Pagable()
          .Render();
}
<div style="margin: 10px; overflow: hidden;">
    <ul class="d-horizontal-list">
        <li><span class="forum-icon-thread forum-icon-thread-default" style="float: left;"></span>
            <span style="float: left; padding-top: 4px; padding-left: 2px;">@Html.Global("forums", "Thread")</span></li>
        <li><span class="forum-icon-thread forum-icon-thread-new" style="float: left;"></span>
            <span style="float: left; padding-top: 4px; padding-left: 2px;">@Html.Global("forums", "New")</span></li>
        <li><span class="forum-icon-thread forum-icon-thread-hot" style="float: left;"></span>
            <span style="float: left; padding-top: 4px; padding-left: 2px;">@Html.Global("forums", "Hot")</span></li>
        <li><span class="forum-icon-thread forum-icon-thread-lock" style="float: left;"></span>
            <span style="float: left; padding-top: 4px; padding-left: 2px;">@Html.Global("forums", "Locked")</span></li>
        <li><span class="forum-icon-thread forum-icon-thread-pinned" style="float: left;"></span>
            <span style="float: left; padding-top: 4px; padding-left: 2px;">@Html.Global("forums", "Pinned")</span></li>
        <li><span class="forum-icon-thread forum-icon-thread-announce" style="float: left;">
        </span><span style="float: left; padding-top: 4px; padding-left: 2px;">@Html.Global("forums", "Announcement")</span></li>
    </ul>
</div>
@{ Ajax.Dna().WidgetZone(Html.Global("RES_BOTTOMZONE"), "zone2").HtmlAttributes(new { style = "width: 944px; margin-top: 5px;" }).Render(); }
